package com.daisuxia.risk.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * 配置文件读取工具
 * @author zhangsh Tel:13817876783
 * @date 2017年8月9日 上午9:52:09
 * @Title: PropertiesUtils
 * @ClassName: PropertiesUtils
 * @Description:
 */
public class PropertiesUtils {
	
	
	private static final Logger logger = LoggerFactory.getLogger(PropertiesUtils.class);
	
	private static Properties prop = new Properties();
	public static String confile = "config.properties"; 
	
	
	public static String getProperty(String key){
		return prop.getProperty( key );
	}
	
	public static String getProperty(String key1, String key2) {
		return prop.getProperty(key1,key2);
	}
	
	static {
		
		try {
			InputStream input =PropertiesUtils.class.getResourceAsStream("/config.properties"); // 对应resources下的文件

			prop.clear();
			prop.load(input);

			logger.info("config.properties加载成功......");
			logger.info(prop.toString());

		} catch (IOException e) {
			e.printStackTrace();
			
		}
		
	}

}
